import xadmin

from apps.organizations.models import Teacher, CourseOrg, City


class TeacherAdmin(object):
    list_display = ["name", "age", "work_years","work_company","org"]
    search_fields = ["name", "age", "work_years","work_company","org"]
    list_filter = ["name", "age", "work_years","work_company","org"]
    list_editable = [ "name", "age", "work_years","work_company","org"]
    readonly_fields = ["click_nums", "fav_nums", "add_time"]
    model_icon = 'fa fa-address-card-o'

class CourseOrgAdmin(object):
    list_display = ["name", "desc", "click_nums", "fav_nums", 'is_auth', 'is_gold']
    search_fields = ["name", "desc", "click_nums", "fav_nums", 'is_auth', 'is_gold']
    list_filter = ["name", "desc", "click_nums", "fav_nums", 'is_auth', 'is_gold']
    list_editable = ["name", "desc", "click_nums", "fav_nums", 'is_auth', 'is_gold']
    readonly_fields = ["click_nums", "fav_nums", "students", "add_time"]
    model_icon = 'fa fa-institution'
    style_fields = {"detail": "ueditor"}

class CityAdmin(object):
    list_display = ["id", "name", "desc"]
    search_fields = ["name", "desc"]
    list_filter = ["name", "desc", "add_time"]
    list_editable = ["name", "desc"]
    readonly_fields = ["add_time"]
    model_icon = 'fa fa-building-o'

xadmin.site.register(CourseOrg, CourseOrgAdmin)
xadmin.site.register(Teacher, TeacherAdmin)
xadmin.site.register(City, CityAdmin)
